﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        //materialManager myMaterialManager = new materialManager();
        权限管理.permissionManaging  myPermissionManaging = new 权限管理.permissionManaging();
        基础信息管理.baseInfoManaging myBaseInfoManaging   = new 基础信息管理.baseInfoManaging();
        入库信息管理.orderManager myMaterialManager = new 入库信息管理.orderManager();
        public string text = null;
        // 数据库
       
        public Form1()
        {
            InitializeComponent();
            panel1.Top = button_baseInfo.Top + button_baseInfo.Height;
            panel1.Left = 0;
            panel1.Width = this.Width;
            panel1.Height = this.Height - panel1.Top;
            

        }
        
        private void Form1_Load(object sender, EventArgs e)
        {
            
            Form2 form2 = new Form2(text);
            form2.MyEvent += new myDelegate(form2_event);
            form2.Show();
            
        }
        // Form1窗体最初为隐藏模式
        private void Form1_Shown(object sender, EventArgs e)
        {
            this.Visible  = false;
        }
        //委托函数实现
        void form2_event(string text)
        {
            this.Visible = true;
        }

        private void Show_form(Form myform)
        {
            panel1.Controls.Clear();
            //嵌入到底层
            myform.TopLevel = false;
            panel1.Controls.Add(myform);
            myform.Top = 0;
            myform.Width = panel1.Width;
            myform.Height = panel1.Height;
            myform.Show();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("OK Button");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            
        }

        //private void 权限管理ToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    systemManager myForm3 = new systemManager();
        //    myForm3.ShowDialog();
        //}

        private void button_baseInfo_Click(object sender, EventArgs e)
        {

            Show_form(myBaseInfoManaging);
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            //myMaterialManager.ShowDialog();
            //myMaterialManager.TopLevel = false;
            Show_form(myMaterialManager);
        }

        private void button2_Click(object sender, EventArgs e)
        {
           // myPermissionManaging.ShowDialog();
           // myPermissionManaging.TopLevel = false;
            Show_form(myPermissionManaging);
        }
        
       
    }
}
